//
//  BGTabViewController.swift
//  Baga
//
//  Created by 飞王 on 16/12/21.
//  Copyright © 2016年 飞王. All rights reserved.
//

import UIKit

class BGTabViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        addChildViewControllers();
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    func addChildViewControllers() {
        addChildViewController(viewController: BGHomeViewController(), imgNamed: "home", title: "首页");
        addChildViewController(viewController: BGShoppingCarViewController(), imgNamed: "huigu", title: "购物车");
        addChildViewController(viewController: BGCollectionViewController(), imgNamed: "zhibo", title: "收藏");
        addChildViewController(viewController: BGMineViewContrller(), imgNamed: "wode", title: "我的");
    }
    
    func addChildViewController(viewController: UIViewController, imgNamed: String, title: String) {
        viewController.title = title;
        
        viewController.tabBarItem.image = UIImage(named: "\(imgNamed)_normal");
        viewController.tabBarItem.selectedImage = UIImage(named: "\(imgNamed)_selected");
        
        addChildViewController(BGNavigationViewController(rootViewController: viewController));
    }

}
